using Tatibah;

namespace TablesWithInTables
{
	// See the DocumetAPI.PDF for the results
    class Program
	{
		static void Main(string[] args)
		{
			// Create the document
            Document document = new Document(@"C:\Tatibah\Results\TablesWithInTables.docx");

			// Create a 1x2 Table
            Table outer = new Table(1, 2);
			
			  // Append a Paragraph to the first Cell
            outer[0][0].Append(new Paragraph("The cell to the right contain another table ") 
                { LeftIndentation = Document.cmsToDxa(1), RightIndentation = Document.cmsToDxa(1) });

            // Create the inner Table. No content just coloured backgrounds
            Table inner = new Table(2, 2);
            inner.Columns[0].Width = Document.cmsToDxa(2);
            inner.Columns[1].Width = Document.cmsToDxa(2);
            inner[0][0].BackgroundColour = "FF0000"; // Red
            inner[0][1].BackgroundColour = "00FF00"; // Green
            inner[1][0].BackgroundColour = "0000FF"; // Blue
            inner[1][1].BackgroundColour = "FFFF00"; //Yellow

            // Append the inner table to the second Cell of the first table
            outer[0][1].Append(inner);
            document.Append(outer);


            // Save the Document
            document.Save();
            document.Close();

        }
    }
}
